package com.igeek.compus.test.notice.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;


import java.util.Date;

@Data
public class Notice {
    private Integer id;
    private String title;
    private String content;
    private Integer publisher;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    private Integer isDel;

    private Integer page;// 前端传多少页
    private Integer limit;// 每页展示多少条数据
    private Integer pageIndex;

    public Integer getPageIndex() {
        if(page != null && limit != null) {
            return (page - 1) * limit;
        }
        return pageIndex;
    }

    @Override
    public String toString() {
        return "Notice{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", publisher=" + publisher +
                ", createTime=" + createTime +
                ", isDel=" + isDel +
                '}';
    }
}
